package ru.inse.web.module;

import ru.inse.core.service.dict.ICityService;
import ru.inse.web.components.InseComponentFactory;
import ru.inse.web.layout.InseLayoutFactory;
import ru.inse.web.page.InsePageFactory;
import ru.xeden.core.resource.IResourceSource;
import ru.xeden.web.html.module.AbstractModule;
import ru.xeden.web.html.module.IModule;

public class InseModule
    extends AbstractModule
    implements IInseModuleRegisterService
{
    
    public static final String ID = "inse";
    private ICityService cityService;

    
    public InseModule(IResourceSource resourceLoader)
    {
        setComponentFactory(new InseComponentFactory(this));
        setLayoutFactory(new InseLayoutFactory(resourceLoader));
        setPageFactory(new InsePageFactory());
    }

    @Override
    public String getId()
    {
        return ID;
    }

    @Override
    public String getDisplayName()
    {
        return ID;
    }

    @Override
    public String getUrlPiece()
    {
        return "inse";
    }

    @Override
    public int getDisplayOrder()
    {
        return 0;
    }

    @Override
    public boolean register(IModule module)
    {
        return registrSubModule(module);
    }

    @Override
    public boolean unregister(IModule module)
    {
        return unregistrSubModule(module);
    }
    
    @Override
    public InseModule getInseModule()
    {
        return this;
    }

    public ICityService getCityService()
    {
        return cityService;
    }

    public void setCityService(ICityService cityService)
    {
        this.cityService = cityService;
    }
}
